//
//  DMUserDataManager.m
//  DaMaoMall
//
//  Created by HXHL-wally on 16/7/20.
//  Copyright © 2016年 daMao-wally. All rights reserved.
//

#import "DMUserDataManager.h"
#import "Keychain.h"

@implementation DMUserDataManager

static NSString * const KEY_IN_KEYCHAIN = @"com.DaMaoMall.app.allinfo";
static NSString * const KEY_PASSWORD = @"com.DaMaoMall.app.password";
static NSString * const serviceName = @"";
static NSString * const account = @"";
static NSString * const KEY_TOKEN = @"";

// 保存、更新密码
+(void)savePassWord:(NSString *)password
{
    NSMutableDictionary * usernamepasswordKVPairs = [NSMutableDictionary dictionary];
    [usernamepasswordKVPairs setObject:password forKey:KEY_PASSWORD];
    [Keychain setPassword:password forService:serviceName account:account];
}
//查找
+(id)fandPassWord
{
    NSMutableDictionary *usernamepasswordKVPair = (NSMutableDictionary *)[Keychain passwordForService:serviceName account:account];
    return [usernamepasswordKVPair objectForKey:KEY_PASSWORD];
}
// 删除
+(void)deletePassWord
{
//    [Keychain delete:KEY_IN_KEYCHAIN];
    [Keychain deletePasswordForService:serviceName account:account];
}

@end
